@extends('orange.layouts.indexPublic')
@section('title'){{$job_search.Site::get('area_name').'找工作|最新招聘信息|'.Site::get('webname')}} @endsection
@section('headcss')
    @parent
    <link rel="stylesheet" href="{{asset('/orange/css/index/job.css')}}">
@endsection
{{--主体内容--}}
@section('content')
    {{--主导航--}}
    @include('orange.layouts.mainNav')
    {{--主导航结束--}}

    {{--logo、搜索栏--}}
    <div class="logoAndSearch">
        <div class="wrapper">
            <form id="resumeSearch" class="search" action="{{url('job')}}" name="resumeSearch" method="post" >
                {{csrf_field()}}
                <input type="hidden" value="0" id="keyword_type" name="keyword_type" data-value="0">
                <input type="hidden" value="0" id="selArea" name="selArea" data-value="1">
                <div class="searchCont">
                    <div id="keyword_type_select" class="select"><span><a></a></span><i></i></div>
                    <input name="keyword" type="text" placeholder="搜一搜总有适合你的工作" />
                    <button type="submit">搜索</button>
                </div>
                <div class="hotKeywords">
                    <span>热门关键字：</span>
                    <a href="javascript:void(0)">销售经理</a>
                    <a href="javascript:void(0)">销售代表</a>
                    <a href="javascript:void(0)">会计</a>
                </div>
            </form>
            @if(!empty($map_show))
                <div class="curr_location">
                    <span class="myLocation">当前位置：</span>
                    <span class="location">{{str_limit($curr_position,14)}}</span>
                    <a class="editLocation" id="popupBox" href="javascript:void(0)">修改</a>
                </div>
            @else
                <div class="byMap"><i></i><a href="{{asset('/job?map_show=1')}}">地图找工作</a></div>
            @endif
        </div>
    </div>
    {{--logo、搜索栏结束--}}

    {{--主要内容--}}
    <div class="main">
        <div class="wrapper">
            {{--筛选栏--}}
            <form id="job_form" class="filter" name="job_form"  method="post" action="{{asset('/post_search/')}}">
                <ul class="clearfix">
                    <li class="location">
                        <span>地区选择</span>
                        <div class="cont">
                            @if(count($area) > 0)
                                @foreach($area as $k=>$v)
                                    @if($v['check']==1)
                                        <a href="{{$v['url']}}" class="{{($v['text'] == '不限') ? 'noLimit':''}} selected">
                                            {{$v['text']}}
                                        </a>
                                    @else
                                        <a href="{{$v['url']}}" >{{$v['text']}}</a>
                                    @endif
                                @endforeach
                            @endif
                        </div>
                        <input name="jobsort1" type="hidden" id="jobsort1" value="{{$input['jobsort1'] or ''}}">
                        <input name="jobsort2" type="hidden" id="jobsort2" value="{{$input['jobsort2'] or ''}}">
                        <input name="jobsort3" type="hidden" id="jobsort3" value="{{$input['jobsort3'] or ''}}">
                        <input name="jobsort4" type="hidden" id="jobsort4" value="{{$input['jobsort4'] or ''}}">
                        <input name="jobsort5" type="hidden" id="jobsort5" value="{{$input['jobsort5'] or ''}}">
                        <input name="jobarea1" type="hidden" id="jobarea1" value="{{$input['jobarea1'] or ''}}">
                        <input name="jobarea2" type="hidden" id="jobarea2" value="{{$input['jobarea2'] or ''}}">
                        <input name="jobarea3" type="hidden" id="jobarea3" value="{{$input['jobarea3'] or ''}}">
                        <input name="jobarea4" type="hidden" id="jobarea4" value="{{$input['jobarea4'] or ''}}">
                        <input name="jobarea5" type="hidden" id="jobarea5" value="{{$input['jobarea5'] or ''}}">
                        <input type="hidden" name="jobsort" id="jobsort" value="{{$cninput['jobsort'] or ''}}" aria-invalid="false" class="valid">
                        <a id="areamore" class="more" href="javascript:void(0)">更多<i></i></a>
                    </li>
                    <li class="welfare">
                        <span>福 利<i></i></span>
                        <div class="cont">
                            @if(count($welfare) > 0)
                                @foreach($welfare as $k=>$v)
                                    @if($v['value']==$input['welfare'])
                                        <a href="{{$v['url']}}" class="{{($v['text'] == '不限') ? 'noLimit':''}} selected">
                                            {{$v['text']}}
                                        </a>
                                    @else
                                        <a href="{{$v['url']}}" >{{$v['text']}}</a>
                                    @endif
                                @endforeach
                            @endif
                        </div>
                    </li>
                    <li class="salary">
                        <span>职位月薪</span>
                        <div class="cont">
                            @if(count($salary) > 0)
                                @foreach($salary as $k=>$v)
                                    @if($v['value']==$input['salary'])
                                        <a href="{{$v['url']}}" class="{{($v['text'] == '不限') ? 'noLimit':''}} selected">
                                            {{$v['text']}}
                                        </a>
                                    @else
                                        <a href="{{$v['url']}}" >{{$v['text']}}</a>
                                    @endif
                                @endforeach
                            @endif
                        </div>
                    </li>
                    <li class="others">
                        <span>其 它<i></i></span>
                        <div class="cont">
                            <div class="selectIndustry" id="industrymore">
                                <input name="industry1" type="hidden" id="industry1" value="{{$input['industry1'] or ''}}">
                                <input name="industry2" type="hidden" id="industry2" value="{{$input['industry2'] or ''}}">
                                <input name="industry3" type="hidden" id="industry3" value="{{$input['industry3'] or ''}}">
                                <input name="industry4" type="hidden" id="industry4" value="{{$input['industry4'] or ''}}">
                                <input name="industry5" type="hidden" id="industry5" value="{{$input['industry5'] or ''}}">
                                <input type="text" name="industry" id="industry" value="{{$cninput['industry'] or ''}}" readonly style="cursor: text"
                                       placeholder="行业不限"/>
                                <i></i>
                            </div>
                            {{--工作年限--}}
                            <input id="work_year" name="work_year" type="hidden" value="{{$input['work_year'] or ''}}">
                            <div id="work_year_select" class="select"><span><a></a></span><i></i></div>
                            {{--学历--}}
                            <input id="education" name="education" type="hidden" value="{{$input['education'] or ''}}">
                            <div id="education_select" class="select"><span><a></a></span><i></i></div>
                            {{--<select class="select updateTime" name="updateTime" data-value="0" style="display: none">--}}
                                {{--<option value="0">更新时间</option>--}}
                            {{--</select>--}}
                        </div>
                    </li>
                </ul>
                <a class="retract"><em></em>收起</a>
            </form>
            {{--筛选栏结束--}}

            {{--职位列表--}}
            <div class="jobsList">
                <div class="top">
                    <div class="jobsSum">共<strong>{{ $company_job->total() }}</strong>个职位</div>
                    <div class="checkBox">
                        <input id="graduate" type="checkbox" @if($input['work_year']=='9')checked @endif><label for="graduate">应届生</label>
                        <input id="anxious" type="checkbox" @if($input['anxious']!='')checked @endif><label for="anxious">急聘</label>
                        <input id="brandCompany" type="checkbox" @if($input['brandcompany']!='')checked @endif><label for="brandCompany">名企</label>
                    </div>
                    <div class="pageNum">
                        @if($company_job->lastPage() == 1 || $company_job->currentPage() == 1)
                            <a> < </a>
                        @else
                            <a class="prev" href="{{$company_job->previousPageUrl()}}"> < </a>
                        @endif
                        <strong>{{$company_job->total()== 0 ? 0 : $company_job->currentPage()}}</strong>/{{$company_job->lastPage()}}
                        @if($company_job->lastPage() == 1 || $company_job->currentPage() == $company_job->lastPage())
                            <a> > </a>
                        @else
                            <a class="next" href="{{$company_job->nextPageUrl()}}"> > </a>
                        @endif
                    </div>
                </div>
                <ul class="lists">
                    @if($company_job->count())
                        @foreach ($company_job as $k=>$v)
                            <li>
                                <div class="left">
                                    <p class="left-p1">
                                        <a href="{{url('/jobinfo_'.idEncryption($v->id).'.html')}}" target="_blank">{{ str_limit($v->job_title,22) }}</a>
                                        @if($v->urgent==1)<i class="status one"></i>@endif
                                        @if(!empty($v->part_status) && $v->part_status == '2')
                                            <i class="status two"></i>
                                        @elseif(!empty($v->part_status) && $v->part_status == '3')
                                            <i class="status three"></i>
                                        @elseif(!empty($v->part_status) && $v->part_status == '4')
                                            <i class="status four"></i>
                                        @endif
                                        <span>{{$v->updatetime or ''}}</span>
                                    </p>
                                    <p class="left-p2">
                                        <strong>{{$v->salary_above or ''}}</strong>
                                        <span>{{msubstr($v->location,0,12)}}</span>
                                        @if(!empty($v->work_year))<span>{{$v->work_year}}</span>@endif
                                    </p>
                                    <p class="left-p3">{!! $v->welfare !!}</p>
                                </div>
                                <div class="right">
                                    <p class="right-p1"><a href="{{url('/comabout_'.idEncryption($v->com_id).'.html')}}" target="_blank">{{str_limit($v->company_name,32)}}</a></p>
                                    <p class="right-p2">{{ str_limit($v->industry,32)}}</p>
                                    <p class="right-p3">@if(!empty($v->employee_num)) {{$v->employee_num }}@endif</p>
                                </div>
                                @if(!empty($map_show))
                                    <div class="mapShow" data-id="{{$v->longitude}},{{$v->latitude}},{{$v->company_name}}"><span>{{$v->juli}}</span><i></i></div>
                                @endif
                            </li>
                        @endforeach
                    @else
                        <li class="no-one">
                            <img src="{{ asset("/default/images/index/bgpic.jpg") }}">
                            <p>对不起,没有符合条件的记录!</p>
                        </li>
                    @endif
                </ul>
                <div class="pagination">
                    {!! $page !!}
                </div>
            </div>
            {{--职位列表结束--}}

            {{--推荐简历--}}
            <div class="recommend">
                <h2>推荐职位</h2>
                <ul>
                    @if(count($recommendedjob) > 0)
                        @foreach($recommendedjob as $k=>$v)
                            <li>
                                <p class="p1"><a href="{{url('/jobinfo_'.idEncryption($v->id).'.html')}}" target="_blank">{{str_limit($v->job_title,16)}}</a></p>
                                <p class="p2">{{ $v->salary_above or '' }}</p>
                                <p class="p3"><a href="{{url('/comabout_'.idEncryption($v->com_id).'.html')}}" target="_blank">{{str_limit($v->company_name,16)}}</a></p>
                            </li>
                        @endforeach
                    @endif
                </ul>
            </div>
            {{--推荐简历结束--}}
        </div>

    {{--浮动层--}}
    {{--@include('default.layouts.floating')--}}
    <!--地图定位DIV遮掩层-->
        <div id="keep_sceen" class="cover hide"></div>
        <div id="twoKeep_sceen" class="twoCover hide"></div>
        <div id="mappositoon" class="mappositoon hide"><span>正在定位中，请稍候...</span></div>
        <!--选择地图定位map-->
        <div id="box_sceen" class="box_sceen hide">
            <div class="mapcon">
                <div class="mtop">
                    <h3>选择位置</h3>
                    <span> <a class="determine">确定</a> <a href="javascript:void(0);" class="cancel">取消</a></span> </div>
                <div class="mleft">
                    @if(count($place) > 0)
                        @foreach($place as $v)
                            <ul>
                                <li class="title">{{$v['city']}}</li>
                                @if(!empty($v['place']))
                                    <li>
                                        @foreach($v['place'] as $vv)
                                            <a ref="{{$vv->longitude}},{{$vv->latitude}},{{$vv->name}}">{{$vv->name}}</a>
                                        @endforeach
                                    </li>
                                @endif
                            </ul>
                        @endforeach
                    @endif
                </div>
                <div class="mright" id="mapshow"></div>
            </div>
        </div>

        <!--地图公交驾车线路DIV遮掩层-->
        <div id="threeKeep_sceen" class="twoCover hide" style="height:600px;"></div>
        <div id="threebox_sceen" class="box_sceen threebox hide">
            <div class="gLine">
                <h3>地图线路</h3>
                <span><a id="close"></a></span> </div>
            <div class="busMap">
                <div class="bLeft" id="mapshow2"></div>
                <div class="bright">
                    <ul>
                        <li><a>公交路线</a></li>
                        <li class="g_title" ><a>驾车路线</a></li>
                    </ul>
                    <div class="bus">
                        <div class="content" id="r-result"></div>
                    </div>
                    <div class="car">
                        <div class="content" id="l-result"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {{--主要内容--}}
@endsection
{{--职位列表js--}}
@section('js')
    @parent
    <script type="text/javascript" src="{{Resources::jsOption('jobsearch')}}"></script>
    <script type="text/javascript" src="{{asset('/vendor/org/layer/layer.js')}}"></script>
    <script type="text/javascript" src="{{asset('/orange/js/index/job.js')}}"></script>
    <script type="text/javascript" src="{{asset('/default/js/jquery/jquery.calling.js')}}"></script>
    <script type="text/javascript" src="{{asset('/default/js/jquery/jquery.area.js')}}"></script>

    @if(!empty($map_show))
        <script type="text/javascript" src="{{asset('/orange/js/index/mapsceen.js')}}"></script>
        <script type="text/javascript" src="{{getRequestType()}}://api.map.baidu.com/api?v=2.0&ak={{Site::get('mapKey')}}"></script>
        <script>
            var mypos = '{{$mypos}}';
            var set_seesion = '{{$set_seesion}}';
            var _token ='{{csrf_token()}}';
        </script>
    @endif
    <script>
        var education_url = '{!!$optionsurl['education']!!}';
        var work_year_url = '{!!$optionsurl['work_year']!!}';
        var jobarea_url = '{!!$optionsurl['jobarea']!!}';
        var jobsort_url = '{!!$optionsurl['jobsort']!!}';
        var industry_url = '{!!$optionsurl['industry']!!}';
        var anxious_url = '{!!$optionsurl['anxious']!!}';
        var brandcompany_url = '{!!$optionsurl['brandcompany']!!}';

        $(function(){
            //筛选栏地区选择中更多按钮点击事件
            $("#areamore"). click(function(){
                workplaceInputGet('');
            });

            //筛选栏其他选项中选择行业按钮点击事件
            $("#industrymore"). click(function(){
                callInputGet('');
            });
        });

        //选择行业弹出框中行业选择及操作
        function callInputGet(randfrm,type){
            var callarr = {
                objId: '#comcall'+randfrm,					//当前显示内容的ID值
                objCate:'#callCate'+randfrm,					//当前页面弹出层显示要追加的工作地区类别内容
                objTwoCate:'#twocallCate'+randfrm,				//当前页面要追加的工作地区类别内容
                objChcekbox:'#comcallings'+randfrm,			//当前弹出层 复选框checkbox的前缀名id值
                objSelect:'callSelect'+randfrm,				//当前弹出层 追加到弹出要追加的内容里面的ID前缀值
                objTwoSelect:'twocallSelect'+randfrm,			//当前页面  追加到当前页面要追加的内容里面的ID前缀值
                objPostCate:'#industry',                          //当前页面  追加到当前页面input要追加的内容里面的ID前缀值
                objArr : ["#industry1"+randfrm,"#industry2"+randfrm,"#industry3"+randfrm,"#industry4"+randfrm,"#industry5"+randfrm], 	//当前隐藏表单
                keep_sceen :'#keep_sceen',					//遮掩层
                objLevel:'1',								//设置当前显示的级别
                objInpaLength:'5',							//设置当前input 表单选项的个数
                callback:function(val,text){
                    var urlget='';
                    $.each(val,function(k,v){
                        k++;
                        if(v!=''){
                            if(k!=1) urlget+='&';
                            urlget+='industry'+k+'='+v;
                        }else{
                            return false;
                        }
                    });
                    var exl="?";
                    if(industry_url.indexOf("?") > 0 ){
                        exl='&';
                    }
                    window.location=industry_url+exl+urlget;
                }
            };
            callObj.showextend(randfrm,callarr);
        }

        //更多弹出框选择值获取及操作
        function workplaceInputGet(randfrm){
            var workarr = {
                objId: '#jobLoc'+randfrm,					//当前显示内容的ID值
                objProvince: 'address_P'+randfrm,	        //当前select省份
                objCity: 'address_C'+randfrm,		        //当前select市区县
                objCate:'#locCate'+randfrm,					//当前页面弹出层显示要追加的工作地区类别内容
                objTwoCate:'#twolocCate'+randfrm,		    //当前页面要追加的工作地区类别内容
                objChcekbox:'#jobLocations'+randfrm,	    //当前弹出层 复选框checkbox的前缀名id值
                objSelect:'locSelect'+randfrm,				//当前弹出层 追加到弹出要追加的内容里面的ID前缀值
                objTwoSelect:'twolocSelect'+randfrm,	    //当前页面  追加到当前页面要追加的内容里面的ID前缀值
                objPostCate:'#workplace',					//当前页面  追加到当前页面input要追加的内容里面的ID前缀值
                objArr : ["#jobarea1"+randfrm,"#jobarea2"+randfrm,"#jobarea3"+randfrm,"#jobarea4"+randfrm,"#jobarea5"+randfrm], //当前隐藏表单
                keep_sceen :'#keep_sceen',					//遮掩层
                objLevel:'3',								//设置当前显示的级别
                objInpaLength:'5',							//设置当前input 表单选项的个数
                callback:function(val,text){
                    var urlget='';
                    $.each(val,function(k,v){
                        k++;
                        if(v!=''){
                            if(k!=1) urlget+='&';
                            urlget+='jobarea'+k+'='+v;
                        }else{
                            return false;
                        }
                    });
                    var exl="?";
                    if(jobarea_url.indexOf("?") > 0 ){
                        exl='&';
                    }
                    window.location=jobarea_url+exl+urlget;
                }
            };
            workObj.showextend(randfrm,workarr);
        }
    </script>
@endsection